#!/usr/bin/perl
#logs_setting.cgi

require './mdmjobs-lib.pl';
&ReadParse();

&header($text{'logs_detail'}, "", "index", 0, 1,undef,undef);
print "<form action=mdm_logs.cgi method=post onsubmit='return checkselect(\"$text{'err_nomember'}\");'>\n";
print "<table class=mode1 border=0 cellspacing=0 cellpadding=0>\n";
print "<tr><td>\n";
local $grpinfo=&foreign_call("mdmgroups","get_groupinfo");
local %grpinfo=%$grpinfo;
local @group = split (/,/,$grpinfo{'[group]'});
&select_members(\@group);	
print "</td></tr>\n";

print "<tr><td><table class=mode1 border=0 cellspacing=0 cellpadding=2>\n";
print "<hr align=left width=550>\n";
print "<tr><td><table class=mode1 border=0 cellspacing=0 cellpadding=2>\n";
print "<h4>$text{'index_setlog'}</h4>\n";
print "$text{'index_setlogmsg'}<p>\n";
print "</table></td></tr>\n";

print "<tr><td><table class=mode1 border=0 cellspacing=0 cellpadding=4>\n";
print "<tr><td><input type=radio checked name=setlog value='nasmesg'>&nbsp;<b>$text{'log_nasmesg'}</b></td></tr>\n";
print "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$text{'log_maxsize'}</td><td><input value='' name=naslog_maxsize></td></tr>\n";
print "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$text{'log_option'}</td>\n";
print "<td><select name=nasoption>\n";
print "<option seleted value=0>$text{'log1'}\n";
print "<option value=1>$text{'log2'}\n";
print "<option value=2>$text{'log3'}\n";
print "<option value=3>$text{'log4'}\n";
print "</select></td> </tr>\n";
print "<tr><td><input type=radio name=setlog value='sysmesg'>&nbsp;<b>$text{'log_sysmesg'}</b></td></tr>\n";
print "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$text{'log_maxsize'}</td><td><input value='' name=syslog_maxsize></td></tr>\n";
print "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$text{'log_option'}</td>\n";
print "<td><select name=sysoption>\n";
print "<option seleted value=0>$text{'log1'}\n";
print "<option value=1>$text{'log2'}\n";
print "<option value=2>$text{'log3'}\n";
print "<option value=3>$text{'log4'}\n";
print "</select></td> </tr>\n";


print "</table></td><tr><table class=mode1 border=0 cellspacing=4 cellpadding=4>\n";
print "<br><tr><input type=submit class=button1 value=\"$text{'index_submit'}\"></table></tr>\n";
print "</table></td></tr>\n";

print "</table></form>\n";
print <<EOF;
<script>
function checkselect(alertmessg1)
{
	if(document.forms[0].memberlist.options.length == 0){
		alert(alertmessg1);
		return false;
	}
	
	if(!confirm("$text{'msg_confirm'}")){
                return false;
        }
	
	if(document.forms[0].listinput.value == ""){
		if(document.forms[0].memberlist.options.length > 0){
			document.forms[0].listinput.value = document.forms[0].memberlist.options[0].text;
		}else{
			document.forms[0].listinput.value = "";
		}	

		for(i = 1; i < document.forms[0].memberlist.options.length; i++){
			document.forms[0].listinput.value += "," + document.forms[0].memberlist.options[i].text;
		}
	}
}
</script>
EOF

&footer("index.cgi", $text{'index_title'});
1;
